﻿using UnityEngine;
using System.Collections;

namespace Inlycat.AI.BehaviorTree
{
    public class ActionGoHome : BNodeAction
    {
        private bool over = false;
        private float m_fTime;

        public ActionGoHome() : base()
        {
            this.m_StrName = "GoHome";
        }

        public override void OnEnter(BInput input)
        {
            this.over = false;
            this.m_fTime = Time.time;

            Debug.Log("On Home");
        }

        public override ActionResult Execute(BInput input)
        {
            if (Time.time - this.m_fTime > 2f)
            {
                this.over = true;
            }

            if (this.over)
            {
                return ActionResult.SUCCESS;
            }

            return ActionResult.RUNNING;
        }
    }


}
